Repository navigation
fix(mcp): Chart the busiest groups and keep empty buckets empty - #2453
sentry-junior[bot] wants to merge 3 commits into
Conversation
render_sentry_chart ranked top groups by the charted aggregate, so p95 by release picked releases with a handful of events at the 30s pageload cap and hid the releases carrying the traffic. Rank groups by event count instead, fetched as a second yAxis, which also gives each series its count. Buckets with no data are null instead of 0 and draw as gaps. The result shares one times array across series and sends per-series value arrays, so 7d at 1h with 5 series drops from about 200 KB to about 12 KB. The legend shortens commit SHAs and shows each series' event count, and the peak describes the busiest series. The events-timeseries mock now honors sort and returns sparse groups with null buckets, and the verify-toolkit host checks ranking, gaps, and the result size. Refs #2451 Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📊 MCP Server Token Cost ReportSummary
Per-Tool Breakdown
Note: This measures the static overhead of tool definitions sent to LLM clients with every request. Lower is better. MCP Apps viewsEach
The budget applies to raw bytes, and the view's generator fails over it. |
|
You can also look at how the Century application itself is doing this and see if there are patterns we should copy from there or if there's a better visual or something along those lines. Come back because I don't want a really complicated first implementation when we haven't proven value here, but it has to be performant. It has to be useful. It has to be correct |
|
Also, this MCP server token cost report is pretty noisy. Let's kick off another thread that just keeps that in CI with a status detail thing, which I think we already have. And there's not a budget for the MCP UI stuff. It's just more that each thing should hard fail if it goes over it, over like something that's a reasonable amount of bytes |
Across groups, the highest bucket headlines one group and reads as the chart's peak. Sentry's own chart widgets show no peak, so grouped charts now return peak null and the view omits it. Bumps the view to v3. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
|
I compared this with Sentry's own chart code (TimeSeriesWidget, the Explore charts, The one deliberate difference is which groups get charted. Explore sorts top groups by the y-axis by default and relies on a person to re-sort, with its low-confidence fading and footer to flag thin data. The tool has nobody to re-sort, so it ranks by event count and shows each series' count in the legend. That's one extra aggregate in the same request and no extra payload. I also dropped the peak line for grouped charts, since Sentry doesn't headline one and it reads as ambiguous there (6cede74). I'm keeping v1 at that. Using the API's per-bucket |
|
Visual QA: Both sides ran offline: the mock stdio server, with each view mounted through AppBridge in headless Chromium. Viewports were identical (720px and 400px views at 2x scale) and so was the data. The base build's grouped mock had no sparse releases, so I copied this PR's Changed
Unchanged (pixel diff: 0 pixels)
Findings
|
Grouped charts rank series by event count, but the Explore and Discover link still sorted by the y-axis, so it could list the sparse groups the chart leaves out. The link now adds the count aggregate and sorts by it. buildSpansExplorerUrl now sets aggregateSort instead of sort in aggregate mode, because Explore reads the aggregate table's sort only from that key. search_events spans aggregate links now honor their sort as well. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>












Fixes the
render_sentry_chartproblems in #2451. When the y-axis was p95 and the chart was grouped by release, it showed the five releases with the highest p95. Those were releases with 1–57 events each, all stuck at the 30s pageload cap. Empty buckets were drawn as 0, and every bucket went out as its own object.Series selection. Top groups are now always ranked by event volume. The tool sends
count()as a secondyAxiswithsort=-count(), because Sentry only sorts top events by a column it selects. I went with "always" rather than "only for non-additive aggregates" for three reasons:avg,max,failure_rate, and the like.Trace metrics count per metric, so for
fn(value,name,type,unit)the ranker iscount(value,name,type,unit). A metrics y-axis that doesn't name its metric keeps the old sort by y-axis. On the errors dataset, Discover's top-events query adds the orderby aggregate on its own (auto_aggregations), so-count()works there too.Empty buckets. The chart no longer uses
summarizeSeries, so a missing value staysnulland draws as a gap. A bucket with data on both sides empty draws as a dot, and the tooltip says "no data".summarizeSeriesand the search_events text output are unchanged.Payload. This changes the output schema. The result now has:
timesarray;incompleteandoutsideRetentionas bucket index lists;{ label, count, total, values }, wherevaluesis an array with nulls.Non-integer values keep 8 significant digits, which removes float noise. For 7d at 1h with 5 series, the result drops from about 200 KB to about 12 KB. The text content is the same JSON, so the model's copy shrinks too. The view's URI moves to
ui://sentry/chart/v3.htmlbecause hosts cache views by URI. The tool is experimental, so no stable client sees the schema change.Clarity.
1d7f4b2 · 57 events.Open in Sentry. For a grouped chart, the link adds the count aggregate next to the y-axis and sorts by it, so Explore and Discover list the same top groups as the chart. Explore only sorts the aggregate table by a group-by or a charted y-axis, so
count()has to be in the link. Spans Explore reads that sort only fromaggregateSort, sobuildSpansExplorerUrlnow uses that key in aggregate mode. As a side effect, search_events spans aggregate links now honor their sort too; before, Explore ignored it and sorted by the first y-axis.Offline proof. The
events-timeseriesmock now honorssort. For grouped requests it returns three busy releases and five sparse ones: 1–57 events, all at 30s, mostly null buckets. Sorting by p95 picks the sparse five, which is the bug in #2451.map/mcp-apps.mdgains three claims thatmcp-apps-host.mjsdrives, and thegroupedclaim now covers the legend's short labels and event counts, and the absence of a peak:top-by-volumenull-gapscompact-result: a 16 KiB budget for 7d/1h × 5 series. That leaves about 30% headroom over ~12 KB and still catches any return to per-bucket objects.Follow-ups, not in this change:
environment:filter still lets preview and legacy environments compete for the five slots. Defaulting to production would quietly change what the query means, so I'd rather the tool description tell the model to addenvironment:when it groups by release.confidence. The chart could do the same once it has proven useful.via @dcramer.
--
View Session [Sentry]